﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Ecreate.Data
{
    public class SqlStruct
    {
        private List<ParamField> m_ParamFields;
        private string m_SqlString;

        public SqlStruct()
        {
        }

        public SqlStruct(string strSql, List<ParamField> paramField)
        {
            if (PersistenceProperty.DatabaseType == DataBaseType.MSSQLServer)
            {
                this.m_SqlString = strSql.Replace(":", "@");
                this.m_ParamFields = paramField;
            }
            else
            {
                this.m_SqlString = strSql.Replace("@", ":");
                this.m_ParamFields = paramField;
            }
        }

        public List<ParamField> ParamFields
        {
            get
            {
                return this.m_ParamFields;
            }
            set
            {
                this.m_ParamFields = value;
            }
        }

        public string SqlString
        {
            get
            {
                return this.m_SqlString;
            }
            set
            {
                if (PersistenceProperty.DatabaseType == DataBaseType.MSSQLServer)
                {
                    this.m_SqlString = value.Replace(":", "@");
                }
                else
                {
                    this.m_SqlString = value.Replace("@", ":");
                }
            }
        }
    }
}
